#if _MSC_VER > 1000
#pragma once
#endif

#ifndef __UFFS_BASICFILE_H_
#define __UFFS_BASICFILE_H_

#define _NO_CUFFSFILE_CLASSOBJECT_

#include "_CUffsFile.h"

#include "uffs\uffs.h"
#include "uffs\uffs_fs.h"

CarClass(CUffsFile)
{
public:
    ECode Initialize(uffs_Object *objHandle);

    CUffsFile();

    ~CUffsFile();

    ECode GetObjectInfo(int type, Int32 *pData);

    CARAPI Read(
        /* [in] */ Int32  offset,
        /* [in] */ Int32  toRead,
        /* [out] */ MemoryBuf * pBuf);

    CARAPI Write(
        /* [in] */ Int32  offset,
        /* [in] */ const MemoryBuf & ezbBuf,
        /* [out] */ Int32  * pWrite);

    CARAPI GetSize(
        /* [out] */ Int32  * pSize);

    CARAPI SetSize(
        /* [in] */ Int32  size);

    CARAPI GetOptimalBlockSize(
        /* [out] */ Int32  * pSize);

    CARAPI Sync();

    CARAPI GetType(
        /* [out] */ FileType * pType);

    CARAPI GetAccessTime(
        /* [out] */ Int32 * pTime);

    CARAPI SetAccessTime(
        /* [in] */ Int32 time);

    CARAPI GetModificationTime(
        /* [out] */ Int32 * pTime);

    CARAPI SetModificationTime(
        /* [in] */ Int32 time);

    CARAPI GetCreateTime(
        /* [out] */ Int32 * pTime);

    CARAPI CheckAccessMode(
        /* [in] */ FileAccessMode mode);

    CARAPI GetAccessMode(
        /* [out] */ FileAccessMode * pMode);

    CARAPI SetAccessMode(
        /* [in] */ FileAccessMode mode);

    CARAPI GetShareMode(
        /* [out] */ FileShareMode *pMode);

    CARAPI SetShareMode(
        /* [in] */ FileShareMode mode);

    CARAPI AddFileMonitor(
        /* [out] */ IEvent **ppEvent);

    CARAPI RemoveFileMonitor(
        /* [in] */ IEvent *pEvent);

private:
    uffs_Object  m_objHandle;
    Boolean m_bInited;
};


#endif //__UFFS_BASICFILE_H_
